using UnityEngine;

namespace Crosstales.Common.Util
{
    // [Assembly-CSharp-firstpass.dll].Crosstales.Common.Util.RandomScaler
    public class RandomScaler : MonoBehaviour
    {
        // Fields
        public bool UseInterval;
        public UnityEngine.Vector2 ChangeInterval;
        public UnityEngine.Vector3 ScaleMin;
        public UnityEngine.Vector3 ScaleMax;
        public bool Uniform;
        public bool RandomScaleAtStart;
        private UnityEngine.Transform tf;
        private UnityEngine.Vector3 startScale;
        private UnityEngine.Vector3 endScale;
        private float elapsedTime;
        private float changeTime;
        private float lerpTime;
        
        // Methods
        private void Start()
        {
            float val_7;
            UnityEngine.Vector3 val_9;
            this.tf = this.transform;
            float val_2 = UnityEngine.Random.Range(minInclusive:  this.ChangeInterval, maxInclusive:  null);
            mem[1152921504930430496] = val_2;
            mem[1152921504930430500] = val_2;
            if(this.RandomScaleAtStart == false)
            {
                goto label_0;
            }
            
            val_7 = System.Math.Abs(this.ScaleMax);
            float val_3 = UnityEngine.Random.Range(minInclusive:  this.ScaleMin, maxInclusive:  val_7);
            val_9 = val_3;
            if(this.Uniform == false)
            {
                goto label_1;
            }
            
            this.startScale = val_9;
            mem[1152921504930430476] = val_9;
            goto label_2;
            label_0:
            UnityEngine.Vector3 val_4 = this.tf.localScale;
            this.startScale = val_4;
            mem[1152921504930430476] = val_4.y;
            mem[1152921504930430480] = val_4.z;
            return;
            label_1:
            this.startScale = val_9;
            float val_7 = System.Math.Abs(val_7);
            mem[1152921504930430476] = UnityEngine.Random.Range(minInclusive:  val_3, maxInclusive:  val_7);
            val_7 = System.Math.Abs(val_7);
            val_9 = UnityEngine.Random.Range(minInclusive:  val_9, maxInclusive:  val_7);
            label_2:
            mem[1152921504930430480] = val_9;
            this.tf.localScale = new UnityEngine.Vector3() {x = this.startScale, y = val_7, z = val_9};
        }
        private void Update()
        {
            UnityEngine.Vector3 val_12;
            float val_13;
            if(this.UseInterval == false)
            {
                    return;
            }
            
            float val_1 = UnityEngine.Time.deltaTime;
            val_1 = this.elapsedTime + val_1;
            this.elapsedTime = val_1;
            if(val_1 > this.changeTime)
            {
                    val_12 = this.ScaleMin;
                val_13 = System.Math.Abs(this.ScaleMax);
                this.elapsedTime = 0f;
                this.lerpTime = 0f;
                float val_2 = UnityEngine.Random.Range(minInclusive:  val_12, maxInclusive:  val_13);
                if(this.Uniform != false)
            {
                    this.endScale = val_2;
                mem[1152921504930430488] = val_2;
            }
            else
            {
                    this.endScale = val_2;
                float val_11 = System.Math.Abs(val_13);
                mem[1152921504930430488] = UnityEngine.Random.Range(minInclusive:  V2.16B, maxInclusive:  val_11);
                val_13 = System.Math.Abs(val_11);
                val_12 = V2.16B;
            }
            
                UnityEngine.Vector2 val_13 = this.ChangeInterval;
                mem[1152921504930430492] = UnityEngine.Random.Range(minInclusive:  val_12, maxInclusive:  val_13);
                this.changeTime = UnityEngine.Random.Range(minInclusive:  val_13, maxInclusive:  val_13);
            }
            
            UnityEngine.Vector3 val_12 = this.endScale;
            val_12 = val_12 - this.startScale;
            float val_7 = S4 - val_13;
            val_7 = ((this.lerpTime >= 0) ? (val_13) : 0f) * val_7;
            val_13 = val_13 + val_7;
            this.tf.localScale = new UnityEngine.Vector3() {x = this.startScale + val_12, y = this.startScale + val_12, z = val_13};
            if(this.lerpTime < 0)
            {
                    float val_9 = UnityEngine.Time.deltaTime;
                float val_14 = this.changeTime;
                val_14 = val_14 + (-0.1f);
                val_9 = val_9 / val_14;
                val_9 = this.lerpTime + val_9;
                this.lerpTime = val_9;
                return;
            }
            
            UnityEngine.Vector3 val_10 = this.tf.localScale;
            this.startScale = val_10;
            mem[1152921504930430476] = val_10.y;
            mem[1152921504930430480] = val_10.z;
        }
        public RandomScaler()
        {
            this.UseInterval = true;
            mem[1152921504930430452] = 1077936128;
            this.ChangeInterval = 134217760.5625;
            this.ScaleMin = ;
            this.Uniform = true;
        }
    
    }

}
